<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>CSS小技巧</title>
    <style>
        * {
            box-sizing: border-box;
            margin: 0;
            padding: 0;
        }

        body {
            height: 100vh;
            display: flex;
            justify-content: center;
            align-items: center;
        }

        button {
            position: relative;
            border: 0;
            border-radius: 10px;
            background-color: pink;
            padding: 10px 20px;
            box-shadow: 0 5px 5px -5px #acacac;
            cursor: pointer;
        }

        button::after {
            position: absolute;
            content: attr(count);
            top: -6px;
            left: calc(100% - 10px);
            display: flex;
            justify-content: center;
            align-items: center;
            min-width: 10px;
            height: 10px;
            font-size: 12px;
            color: white;
            background-color: red;
            padding: 4px;
            border-radius: 30px;
        }
    </style>
</head>
<body>
    <button count="99" onclick="add()">消息</button>

    <script>
        const btn = document.querySelector('button')
        let count = 0
        function add ()
        {
            console.log(1112);
            // btn.setAttribute('count', count++)
        }
    </script>
</body>
</html>